/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pneuservis.backend.services;

import java.util.List;
import javax.ejb.Local;
import pneuservis.backend.to.CustomerTO;


/**
 *
 * @author Juraj Palenik
 */
@Local
public interface CustomerServiceLocal {

    /**
     * Store new customer into database. Id is automatically generated and
     * stored into id attribute.
     *
     * @param customer customer to by created
     * @throws IllegalArgumentException when customer is null, customer has
     * already assigned id.
     */
    public void createCustomer(CustomerTO customer) throws IllegalArgumentException;

    /**
     * Return customer with given id.
     *
     * @param id primary key of requested customer.
     * @return customer with given id or null if such customer does not exist.
     * @throws IllegalArgumentException when given id is null.
     */
    public CustomerTO getCustomer(Long id) throws IllegalArgumentException;

    /**
     * Updates customer in database.
     *
     * @param customer updated customer to be stored into database.
     * @throws IllegalArgumentException when customer is null, or customer has
     * null id.
     */
    void updateCustomer(CustomerTO customer) throws IllegalArgumentException;

    /**
     * Remove customer from database.
     *
     * @param customer customer to be removed from database.
     * @throws IllegalArgumentException when customer is null, or customer has
     * null id.
     */
    void removeCustomer(CustomerTO customer) throws IllegalArgumentException;

    /**
     * Return list of all customers in the database.
     *
     * @return list of all customers in database.
     */
    List<CustomerTO> getAllCustomers();

    /**
     * Method to find customer by name.
     *
     * @param name name to find customers
     * @return list of all customers with given name.
     * @throws IllegalArgumentException when given name is null.
     */
    List<CustomerTO> findCustomerByName(String name) throws IllegalArgumentException;
    
    /**
     * Return customer with given username.
     * 
     * @param username username to find customer
     * @return customer with given username 
     * @throws IllegalArgumentException when username is null or username 
     * does not exist.
     */
    CustomerTO getCustomerByUsername(String username) throws IllegalArgumentException;
}

